# Position function tests

This file tests the code to determine mouse position and element position with respect to the document or viewport.

dojo.html.getAbsolutePosition(xyz, true) tells you where you would position a node inside document.body such that it was on top of xyz. It works well in conjunction with event.pageX/Y.

dojo.html.getAbsolutePosition(xyz, false) returns the position that would be returned by event.clientX/Y if the mouse were directly over the top/left of this node.

- Move the mouse; scroll down the browser window; check that event.pageX/pageY returns the position within the document, rather than the viewport
- Scrolling the browser window should affect getAbsolutePosition(btn, false), but it shouldn't affect getAbsolutePosition(btn, true);
- Scrolling the div should affect both return values
- Try it on IE, FF, and Safari.

1
2
3
4
5
6
7 This is a very long sentence just to make sure there is a horizontal scrollbar

event.pageX/pageY |
getAbsolutePosition(btn, true) (document) |
getAbsolutePosition(btn, false) (viewport) |
dojo.html.overElement(btn, e) |
dojo.html.getScrollLeft()/Top() |

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after

HTML after